<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="author" content="wangbo">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>react 传值 </title>
</head>

<body>
    <div id="app"></div>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <!-- 专门设置props的库 -->
    <script src="../js/prop-types.js"></script>
    <script src="../js/babel.min.js"></script>
    <script type="text/babel">
        class Mycomponent extends React.Component {
            // es7 类的静态属性,必须写到类的里边,java
            // Mycomponent.defaultProps
            static defaultProps ={
                age:20
            }
            // string 字符串
            // object 对象
            // arry 数组
            // bool  布尔类.true/false
            // func 函数
            // node  可以使number,string,arry
            static propTypes={ 
                age:PropTypes.bool
            }
            render() {
                return (
                    // 只渲染字符串
                    <div> 我的名字 {this.props.name}  ------ {this.props.age.toString()}  </div>
                )
            }
            // es6 只有静态的方法,没哟属性
            static show(){
                return '静态方法'
            }
            
        }
        ReactDOM.render(<Mycomponent name='lisi' age={true} />, document.getElementById("app"))
        console.log() 
    </script>
</body>

</html>